<%@page import="store.pay.icbc.IcbcB2cPayObject"%>
<%@page import="store.pay.ConfigObjectHelper"%>
<%@page import="store.pay.icbc.IcbcB2cConfigObject"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
String path = request.getScheme() + "://" + request.getServerName() + request.getContextPath();
String ppath = request.getScheme() + "://" + request.getServerName()+":" + request.getServerPort() + request.getContextPath();


System.out.println(path);

String orderid =request.getParameter("orderid");
String amount=request.getParameter("amount");
String goodsID=request.getParameter("goodsID");
String goodsName=request.getParameter("goodsName");
String goodsNum=request.getParameter("goodsNum");

IcbcB2cPayObject icbcB2c = new IcbcB2cPayObject();
IcbcB2cConfigObject ico = (IcbcB2cConfigObject) ConfigObjectHelper.getConfig(IcbcB2cConfigObject.class);

//icbcB2c.setAmount("1");
icbcB2c.setOrderid(orderid);
icbcB2c.setAmount(String.valueOf(Integer.valueOf(amount).intValue()*10*10));

icbcB2c.setGoodsID(goodsID);
icbcB2c.setGoodsName(goodsName);
icbcB2c.setGoodsNum(goodsNum);

icbcB2c.setMerAcct(ico.getMerAcct());
icbcB2c.setMerID(ico.getMerID());
icbcB2c.setMerURL(path + "/pay/notify/icbc/b2c/server");
icbcB2c.setNotifyType("HS");
icbcB2c.setVerifyJoinFlag("0");
icbcB2c.setResultType("0");
icbcB2c.setGoodsType("0");

icbcB2c.setMerReference("localhost");

icbcB2c.setMerCustomID("00000000112");
icbcB2c.setMerCustomPhone("13599648573");
icbcB2c.setMerOrderRemark("xuezafei");


icbcB2c.setTranData(icbcB2c.tranData());
icbcB2c.setMerSignMsg(icbcB2c.sign());

store.pay.ValidationMsg vm = icbcB2c.validation();
request.setAttribute(store.pay.AutoPayServlet.ATTR_NAME_PAY_OBJECT, icbcB2c);
//request.setAttribute(store.pay.AutoPayServlet.ATTR_NAME_FROM_ACTION, "https://B2C.icbc.com.cn/servlet/ICBCINBSEBusinessServlet");

request.setAttribute(store.pay.AutoPayServlet.ATTR_NAME_FROM_ACTION, ppath + "/pay/bank.jsp");
request.getRequestDispatcher("/AutoPayServlet").forward(request, response);

%>